package com.dys.dao.impl;

import com.dys.dao.IUserDao;
import com.dys.pojo.User;
import com.dys.utils.DbUtils;

import java.util.List;

/**
 * @className: com.dys.dao.impl.UserDaoImpl
 * @description: com.dys.dao.impl
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/11/03 21:42
 */
public class UserDaoImpl implements IUserDao {
    @Override
    public int addUser(User user) {
        return DbUtils.getInstanceFactory().openSession().insert("com.dys.dao.IUserDao.addUser", user);
    }

    @Override
    public int updateUser(User user) {
        return DbUtils.getInstanceFactory().openSession().update("com.dys.dao.IUserDao.updateUser", user);
    }

    @Override
    public int deleteUser(int id) {
        return DbUtils.getInstanceFactory().openSession().delete("com.dys.dao.IUserDao.deleteUser", id);
    }

    @Override
    public List<User> findAllUser() {
        return DbUtils.getInstanceFactory().openSession().selectList("com.dys.dao.IUserDao.findAllUser");
    }
}
